package com.yuji.aacar.controller.dirty;

import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;

import com.yuji.aacar.R;
import com.yuji.aacar.base.BaseActivity;
import com.yuji.aacar.controller.order.WriteOrderActivity;
import com.yuji.aacar.widgets.autolayout.AutoRelativeLayout;
import com.yuji.aacar.widgets.textview.PingFangTextView;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class DirtyActivity extends BaseActivity {

    @BindView(R.id.title_back)
    ImageView titleBack;
    @BindView(R.id.back_image)
    AutoRelativeLayout backImage;
    @BindView(R.id.title_content)
    PingFangTextView titleContent;
    @BindView(R.id.back_login)
    PingFangTextView backLogin;
    @BindView(R.id.title_message_iv)
    ImageView titleMessageIv;
    @BindView(R.id.title_message_rl)
    AutoRelativeLayout titleMessageRl;
    @BindView(R.id.title_rl)
    AutoRelativeLayout titleRl;
    @BindView(R.id.dirty_one_tv)
    PingFangTextView dirtyOneTv;
    @BindView(R.id.dirty_one_fl)
    AutoRelativeLayout dirtyOneFl;
    @BindView(R.id.dirty_two_tv)
    PingFangTextView dirtyTwoTv;
    @BindView(R.id.dirty_two_fl)
    AutoRelativeLayout dirtyTwoFl;
    @BindView(R.id.dirty_three_tv)
    PingFangTextView dirtyThreeTv;
    @BindView(R.id.dirty_three_fl)
    AutoRelativeLayout dirtyThreeFl;
    private DirtyActivityVM dirtyActivityVM;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        setContentView(R.layout.activity_dirty);
        ButterKnife.bind(this);
        initTitle(true, "车辆脏污程度", null);
        super.onCreate(savedInstanceState);


    }

    @Override
    public void alreadyBindBaseViewModel() {
        super.alreadyBindBaseViewModel();
        dirtyActivityVM = (DirtyActivityVM) coreBaseViewModel;
        //        requestParams =
    }

    @OnClick({R.id.dirty_one_fl, R.id.dirty_two_fl, R.id.dirty_three_fl})
    public void onClick(View view) {
        resetLayout();
        Drawable red = getResources().getDrawable(R.drawable.shape_dirty_red);
        int redColor = getResources().getColor(R.color.buttonRed);
        switch (view.getId()) {
            case R.id.dirty_one_fl:
                dirtyOneFl.setBackground(red);
                dirtyOneTv.setTextColor(redColor);
                presentController(WriteOrderActivity.class);
                break;
            case R.id.dirty_two_fl:
                dirtyTwoFl.setBackground(red);
                dirtyTwoTv.setTextColor(redColor);
                presentController(WriteOrderActivity.class);
                break;
            case R.id.dirty_three_fl:
                dirtyThreeFl.setBackground(red);
                dirtyThreeTv.setTextColor(redColor);
                showAlertDialogue("车辆为重度脏程度", "我们暂时无法提供服务", "结束洗车");
                break;
        }

    }

    private void resetLayout() {
        Drawable grey = getResources().getDrawable(R.drawable.shape_dirty_grey);
        dirtyOneFl.setBackground(grey);
        dirtyTwoFl.setBackground(grey);
        dirtyThreeFl.setBackground(grey);

        int color = getResources().getColor(R.color.textcolor);
        dirtyOneTv.setTextColor(color);
        dirtyTwoTv.setTextColor(color);
        dirtyThreeTv.setTextColor(color);
    }
}